package com.dhecp.project.hr.controller;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.dhecp.common.annotation.Log;
import com.dhecp.common.annotation.RepeatSubmit;
import com.dhecp.common.core.domain.AjaxResult;
import com.dhecp.common.core.page.TableDataInfo;
import com.dhecp.common.enums.BusinessType;
import com.dhecp.common.utils.MessageUtils;
import com.dhecp.common.utils.TypeUtils;
import com.dhecp.core.constant.ModuleTable;
import com.dhecp.core.layui.GridColumnsPropertyModel;
import com.dhecp.core.utils.DateUtil;
import com.dhecp.core.utils.ExportExcelUtils;
import com.dhecp.core.utils.ReadExcel;
import com.dhecp.framework.util.ShiroUtils;
import com.dhecp.project.common.controller.BaseModuleController;
import com.dhecp.project.common.domain.ModuleNidAndBid;
import com.dhecp.project.common.service.ModuleNidAndBidService;
import com.dhecp.project.hr.domain.OperateCompanyApply;
import com.dhecp.project.hr.domain.OperateCompanyExit;
import com.dhecp.project.hr.service.OperateCompanyApplyService;
import com.dhecp.project.system.domain.SysDictionaryForExport;
import com.dhecp.project.system.service.SysDictionaryForFieldService;

/**
 * 运营公司备案 控制层
 * @author DH-Xxj
 * @version 2022年3月3日
 */
@Controller
@RequestMapping("/hr/operatecompanyapply")
public class OperateCompanyApplyController extends BaseModuleController{

	private String prefix = "hr/operatecompanyapply";
    private String moduleTable = ModuleTable.OPERATE_COMPANY_APPLY;
    private String moduleTableInfo = ModuleTable.OPERATE_COMPANY_INFO;
    private String moduleTableTC = ModuleTable.OPERATE_COMPANY_TC;

    @Autowired
    private OperateCompanyApplyService businessService;
    
    @Autowired
    private ModuleNidAndBidService moduleNidAndBidService;
    
    @Autowired
    private GridColumnsPropertyModel gridColumnsPropertyModel;
    
    @Autowired
    private SysDictionaryForFieldService dictionaryForFieldService;
    
    /**
     * 打开查询列表页
     * @param params
     * @return
     * @author DH-Xxj 
     */
	@RequiresPermissions("hr:operatecompanyapply:view")
    @GetMapping()
    public ModelAndView listPage(@RequestParam Map<String, Object> params){
		params.put("moduleTable", moduleTable);
    	params.put("entity", new OperateCompanyApply()); //生成表格gridColumns对应的实体，用于获取实体属性生成表格字段
    	params.put("prefix","hr/hr"); //页面路径
        params.put("checkBox", "yes");
    	
    	ModelAndView mv = this.openListPage(params);
    	mv.addObject("hr", "operatecompanyapply");
		return mv;
    }
    
	/**
     * 打开选择列表
	 * @param params
	 * @return
	 * @author DH-Xxj
	 */
    @GetMapping("/select")
    public ModelAndView selectList(@RequestParam Map<String, Object> params){
        params.put("moduleTable", moduleTableInfo);
        params.put("entity", new OperateCompanyApply()); //生成表格gridColumns对应的实体，用于获取实体属性生成表格字段
        params.put("toolBarWidth", 0);
        if(params.get("pagetype") !=null && params.get("pagetype").toString().equalsIgnoreCase("checkbox"))params.put("checkBox", "yes");
        else params.put("radio", "yes");
        ModelAndView mv = this.getModelAndView();
        AjaxResult ajaxResult = new AjaxResult();
        Map<String, Object> dictionaryForFieldMap = new HashMap<String, Object>();

        mv.addObject("fields", TypeUtils.mapToJson(dictionaryForFieldMap));
        mv.addObject("ajaxResult", ajaxResult);
        mv.addObject("gridColumns", gridColumnsPropertyModel.queryGridColumnsPropertyModel(params));
        mv.addObject("prefix", prefix + "/operatecompanyinfo");
        mv.addObject("moduleTable", moduleTableInfo);
        mv.setViewName("common/select");
        return mv;
    }

    @GetMapping("/select2")
    public ModelAndView select2(@RequestParam Map<String, Object> params){
        params.put("moduleTable", moduleTableTC);
        params.put("entity", new OperateCompanyApply()); //生成表格gridColumns对应的实体，用于获取实体属性生成表格字段
        params.put("toolBarWidth", 0);
        if(params.get("pagetype") !=null && params.get("pagetype").toString().equalsIgnoreCase("checkbox"))params.put("checkBox", "yes");
        else params.put("radio", "yes");
        ModelAndView mv = this.getModelAndView();
        AjaxResult ajaxResult = new AjaxResult();
        Map<String, Object> dictionaryForFieldMap = new HashMap<String, Object>();

        mv.addObject("fields", TypeUtils.mapToJson(dictionaryForFieldMap));
        mv.addObject("ajaxResult", ajaxResult);
        mv.addObject("gridColumns", gridColumnsPropertyModel.queryGridColumnsPropertyModel(params));
        mv.addObject("prefix", prefix + "/operatecompanyinfo");
        mv.addObject("moduleTable", "BOUNDCOMPAN");
        mv.setViewName("common/select");
        return mv;
    }

    @GetMapping("/ocselect")
    public ModelAndView ocSelectList(@RequestParam Map<String, Object> params){
        ModelAndView mv = this.getModelAndView();
        params.put("moduleTable", moduleTable);
        mv = this.gotoModelAndViewErrorPage(params, "pagetype","页面类型：radio（单选），checkbox（多选）");
        if (mv.isEmpty()){
            String pagetype = "checkbox".equals(params.get("pagetype").toString())?"checkbox":"radio";
            if (params.get("selectedUser") != null && params.get("selectedUser") != ""){
                String selectedUser = params.get("selectedUser").toString();
                mv.addObject("selectedUser", selectedUser);
            }
            mv.addObject("pagetype", pagetype);
            mv.setViewName(prefix + "/ocselect");
        }
        return mv;
    }
    
	/**
	 * 打开制单页
	 * @param nid 必要参数：单据编码（新增时传默认值 0 ，修改、查看时传单据实际值）
	 * @return
	 * @author DH-Xxj
	 */
    @RequiresPermissions("hr:operatecompanyapply:view")
    @GetMapping("/edit")
    public ModelAndView editPage(@RequestParam Map<String, Object> params){  
		if (params.get("nid") == null || params.get("nid") == ""){
        	params.put("nid", "0");
		}      
    	params.put("moduleTable", moduleTable);
    	params.put("entity", new OperateCompanyApply()); //用于获取实体属性名取代对应字典字段名，解决大小写敏感问题
    	params.put("moduleUrl", prefix); //页面上级路径
    	params.put("prefix", prefix + "/operatecompanyapply_edit"); //页面路径
    	
    	try{
            Map<String, Object> headData = new HashMap<String, Object>();		//表头的业务数据
//          SysModuleSet moduleSet = sysModuleSetService.queryModuleSet(params);//单据设置信息
            OperateCompanyApply businessData = businessService.queryFirstRecord(params);
        	if (businessData == null){ //未查询到对应单据，页面初始化值
        		ModuleNidAndBid moduleNidAndBid = moduleNidAndBidService.queryModuleNidAndBidInitial(params);
        		OperateCompanyApply businessDataNew = new OperateCompanyApply();
            	businessDataNew.setNid("0");
            	businessDataNew.setBid(moduleNidAndBid.getBid());
            	businessDataNew.setCreateTime(new Date());
            	businessDataNew.setCid(ShiroUtils.getMandatorCid());
            	businessDataNew.setCidName(ShiroUtils.getMandatorCidName());
            	businessDataNew.setbUser(ShiroUtils.getMandatorId());
            	businessDataNew.setbUserName(ShiroUtils.getMandatorName());
            	businessDataNew.setbDept(ShiroUtils.getMandatorDeptPath());
            	businessDataNew.setbDeptName(ShiroUtils.getMandatorDeptName());
            	businessDataNew.setbPosition(ShiroUtils.getMandatorPositionNameDa());
            	businessDataNew.setaUser(ShiroUtils.getUserId());
            	businessDataNew.setaUserName(ShiroUtils.getUserName());
            	businessDataNew.setaDept(ShiroUtils.getUserDeptPath());
            	businessDataNew.setaDeptName(ShiroUtils.getUserDeptName());
            	businessDataNew.setaPosition(ShiroUtils.getUserPositionNameDa());
            	businessDataNew.setdBaRq(new Date());
        		headData = TypeUtils.entityToMap(businessDataNew);
        	}else{
        		headData = TypeUtils.entityToMap(businessData);
        	}
        	params.put("headData", headData); //表头的业务数据
        	
        	params.put("checkBox", "yes"); //生成表格gridColumns时包含复选
            ModelAndView mv = this.openEditPage(params);
            return mv;
    	}catch(Exception e){
//    		return this.gotoModelAndViewErrorPage(this.getExceptionMessage(e));	//简单信息
    		return this.gotoModelAndViewErrorPage(e.getMessage());	//详细信息
    	}

    }
    
    /**
     * 打开流转页
     * @param fType 必要参数：审核类型（flow_go：流转，flow_back：退回）
	 * @param infoMap 必要参数：非网格字段（包括所有显示和隐藏的字段），json格式字符串
     * @return
     * @author DH-Xxj
     */
	@RequiresPermissions("hr:operatecompanyapply:flow")
	@PostMapping("/flowpage")
	@ResponseBody
    public AjaxResult flowPage(@RequestParam Map<String, Object> params){
		params.put("moduleTable", moduleTable);
		params.put("prefix", prefix);
//		String flowUrl = flowPageUrl(params);
//		return redirect(flowUrl);
		return openFlowPage(params);
    }
	
	/**
	 * 制单页 明细数据
	 * @param nid 必要参数：当前 单据编码
	 * @return
	 * @author DH-Xxj
	 */
    @RequiresPermissions("hr:operatecompanyapply:list")
	@GetMapping("/listbynid")
    @ResponseBody
    public TableDataInfo listByNid(@RequestParam Map<String, Object> params){
		if (params.get("nid") == null || params.get("nid") == ""){
			return getDataTable(MessageUtils.message("module.error.lack.nid"));
		}
		params.put("moduleTable", moduleTable);
        List<OperateCompanyApply> list = new ArrayList<OperateCompanyApply>();
        try {
        	list = businessService.queryListByNid(params);
        } catch (Exception e) {
            e.printStackTrace();
            return getDataTable(this.getExceptionMessage(e).toString());            
        }
        return getDataTable(list);
    }
    
	/**
	 * 查询前一单NID、BID
	 * @param nid 必要参数：当前 单据编码
	 * @return AjaxResult (data.nid 前一单NID， data.bid 前一单BID)
	 * @author DH-Xxj
	 */
    @RequiresPermissions("hr:operatecompanyapply:view")
    @GetMapping("/lastnid")
    @ResponseBody
    public AjaxResult lastNid(@RequestParam Map<String, Object> params){
		params.put("moduleTable", moduleTable);
    	AjaxResult ajaxResult = new AjaxResult();
        try {
            ajaxResult = businessService.queryLastNid(params);
        }catch (Exception e) {
            ajaxResult = AjaxResult.error(this.getExceptionMessage(e));
        }
        return ajaxResult;
    }

	/**
	 * 查询后一单NID、BID
	 * @param nid 必要参数：当前 单据编码
	 * @return AjaxResult (data.nid 后一单NID， data.bid 后一单BID)
	 * @author DH-Xxj
	 */
    @RequiresPermissions("hr:operatecompanyapply:view")
    @GetMapping("/nextnid")
    @ResponseBody
    public AjaxResult nextNid(@RequestParam Map<String, Object> params){
		params.put("moduleTable", moduleTable);
    	AjaxResult ajaxResult = new AjaxResult();
        try {
            ajaxResult = businessService.queryNextNid(params);
        }catch (Exception e) {
            ajaxResult = AjaxResult.error(this.getExceptionMessage(e));
        }
        return ajaxResult;
    }

	/**
	 * 查询页 列表数据
	 * @param params
	 * @return
	 * @author DH-Xxj
	 */
    @RequiresPermissions("hr:operatecompanyapply:list")
	@GetMapping("/list")
    @ResponseBody
    public TableDataInfo list(@RequestParam Map<String, Object> params){
		params.put("moduleTable", moduleTable);
        List<OperateCompanyApply> list = new ArrayList<OperateCompanyApply>();
        try {
        	list = businessService.queryList(params);
        } catch (Exception e) {
            e.printStackTrace();
            return getDataTable(this.getExceptionMessage(e).toString());            
        }
        return getDataTable(list);
    }

    /**
     * 数据导出Excel
     * @param params
     * @return
     * @throws Exception
     * @author DH-Xxj
     */
    @RequiresPermissions("hr:operatecompanyapply:export")
    @Log(title = "运营公司备案导出", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    @ResponseBody
    @RepeatSubmit
    public AjaxResult export(@RequestParam Map<String, Object> params) throws Exception {
		params.put("moduleTable", moduleTable);
    	params.put("entity", new OperateCompanyApply()); 
    	
        List<OperateCompanyApply> list = businessService.queryList(params);
        
    	params.put("getFieldAttributesType", "export");
    	List<SysDictionaryForExport> fieldList = dictionaryForFieldService.queryExportFieldList(params);
        ExportExcelUtils<OperateCompanyApply> util = new ExportExcelUtils<OperateCompanyApply>(moduleTable,new OperateCompanyApply());
        return util.exportExcel(list, fieldList, "运营公司备案", "export");
    }
    
    /**
     * 导出Excel导入模板
     * @param params
     * @return
     * @throws Exception
     * @author DH-Xxj
     */
    @RequiresPermissions("hr:operatecompanyapply:import")
    @Log(title = "运营公司备案导出", businessType = BusinessType.EXPORT)
    @GetMapping("/exporttemplate")
    @ResponseBody
    @RepeatSubmit
    public AjaxResult exportTemplate(@RequestParam Map<String, Object> params) throws Exception {
		params.put("moduleTable", moduleTable);
    	params.put("entity", new OperateCompanyApply()); 
    	
    	params.put("getFieldAttributesType", "template");
    	List<SysDictionaryForExport> fieldList = dictionaryForFieldService.queryExportFieldList(params);
        ExportExcelUtils<OperateCompanyApply> util = new ExportExcelUtils<OperateCompanyApply>(moduleTable,new OperateCompanyApply());
        return util.exportExcel(null, fieldList, "运营公司备案导入模板", "template");
    }
    
	/**
	 * 保存数据
	 * @param infoMap 必要参数：非网格字段（包括头部、底部所有显示和隐藏的字段）
	 * @param infoItems 必要参数：对应实体类的json格式字符串
	 * @return
	 * @author DH-Xxj
	 */
    @RequiresPermissions(value={"hr:operatecompanyapply:add","hr:operatecompanyapply:edit","hr:operatecompanyapply:delete"},logical=Logical.OR)
    @Log(title = "运营公司备案", businessType = BusinessType.UPDATE)
    @PostMapping("/editpost")
    @ResponseBody
    @RepeatSubmit
    public AjaxResult editSave(@RequestParam Map<String, Object> params){
		params.put("moduleTable", moduleTable);
    	AjaxResult ajaxResult = new AjaxResult();   
        try {
            ajaxResult= businessService.saveData(params);
        }catch (Exception e) {
        	e.printStackTrace();
            ajaxResult = AjaxResult.error(this.getExceptionMessage(e));
        }
        return ajaxResult;
    }
    
	/**
	 * 培训费调整
	 */
    @RequiresPermissions("hr:operatecompanyapply:view")
    @Log(title = "培训费调整", businessType = BusinessType.UPDATE)
    @PostMapping("/editGledfJe")
    @ResponseBody
    @RepeatSubmit
    public AjaxResult editGledfJe(String guid, BigDecimal gledfJe,String depositAccount,String depositInformation){
    	AjaxResult ajaxResult = new AjaxResult();   
        try {
            ajaxResult= businessService.editGledfJe(guid, gledfJe,depositAccount,depositInformation);
        }catch (Exception e) {
            ajaxResult = AjaxResult.error(this.getExceptionMessage(e));
        }
        return ajaxResult;
    }
    
	/**
	 * 修改税号
	 */
    @RequiresPermissions("hr:operatecompanyapply:view")
    @Log(title = "修改税号", businessType = BusinessType.UPDATE)
    @PostMapping("/editVGsSh")
    @ResponseBody
    @RepeatSubmit
    public AjaxResult editVGsSh(String guid, String vGsMc, String vGsSh){
    	AjaxResult ajaxResult = new AjaxResult();   
        try {
            ajaxResult= businessService.editVGsSh(guid, vGsMc, vGsSh);
        }catch (Exception e) {
        	e.printStackTrace();
            ajaxResult = AjaxResult.error(this.getExceptionMessage(e));
        }
        return ajaxResult;
    }
    
	/**
	 * 本地批量导入运营公司备案
	 * @return
	 * @author XDH
	 */
    @GetMapping("/addBatchLocal")
    @ResponseBody
    public AjaxResult addBatchLocal(){
    	AjaxResult ajaxResult = new AjaxResult();
        try {
            List<List<String>> rows = ReadExcel.getRowsByFile("d:\\Users\\Administrator\\Desktop\\导入ERP\\公司信息.xlsx", 0);
            for (int i = 1; i < rows.size(); i++) {
            	System.out.println("---第" + i + "个---");
            	List<String> row = rows.get(i);
            	String vGsMc = row.get(1);
            	String vGsJc = row.get(0);
            	String vGsJcP = row.get(3);
            	String vGsMcP = row.get(4);

            	JSONObject infoMap = new JSONObject();
            	infoMap.put("vGsMc", vGsMc);
            	infoMap.put("vGsJc", vGsJc);

            	infoMap.put("vGsJcP", vGsJcP);
            	infoMap.put("vGsMcP", vGsMcP);
            	
            	OperateCompanyApply operateCompanyApplyParent = businessService.findByShortName(vGsJcP);
            	if (operateCompanyApplyParent == null) {
					continue;
				}
            	
            	// 验证公司是否已经导入
            	OperateCompanyApply operateCompanyApplySub = businessService.findByShortName(vGsJc);
            	if (operateCompanyApplySub != null) {
					continue;
				}
            	
            	infoMap.put("cidName", operateCompanyApplyParent.getCidName());
            	infoMap.put("vGsBmP", operateCompanyApplyParent.getvGsBm());
            	infoMap.put("vGsJbP", "");
            	infoMap.put("vGsShP", operateCompanyApplyParent.getvGsSh());
            	infoMap.put("dBaRq", DateUtil.getYYYY_MM_DD(new Date()));
            	infoMap.put("vGsZt", "正常");
            	infoMap.put("isRatio", "1");
            	infoMap.put("cid", operateCompanyApplyParent.getCid());
            	infoMap.put("nid", "0");
            	infoMap.put("vGsFrId", "111111198902052294");

            	infoMap.put("vGsBm", "");
            	infoMap.put("procInstId", "");
            	infoMap.put("activeFlow", "");
            	infoMap.put("activeFlowName", "准备制单");
            	infoMap.put("bUser", "09933");
            	infoMap.put("bDept", "C101.D101");
            	infoMap.put("aUserName", "初始数据导入");
            	infoMap.put("aUser", "09933");
            	infoMap.put("aDeptName", "数智化事业部");
            	infoMap.put("aDept", "C101.D101");
            	infoMap.put("aPosition", "数智中心专员");
            	infoMap.put("bUserName", "初始数据导入");
            	infoMap.put("bDeptName", "数智化事业部");
            	infoMap.put("bPosition", "数智中心专员");
            	
            	
            	Map<String, Object> params = new HashMap<String, Object>();
            	params.put("infoMap", infoMap);
            	
            	JSONArray infoItemsJA = new JSONArray();
            	JSONObject JO = new JSONObject();
            	JO.put("nid", 0);
            	infoItemsJA.add(JO);
            	params.put("infoItems", infoItemsJA.toJSONString());
            	
            	
        		params.put("moduleTable", moduleTable);
        		
                System.out.println(JSON.toJSONString(params));
                ajaxResult= businessService.saveData(params);
            }
            
        }catch (Exception e) {
        	e.printStackTrace();
            ajaxResult = AjaxResult.error(this.getExceptionMessage(e));
        }
        return ajaxResult;
    }

    /**
     * 流转
	 * @param infoMap 必要参数：非网格字段（包括头部、底部所有显示和隐藏的字段）
	 * @param infoItems 必要参数：对应实体类的json格式字符串（仅需 guid）
     * @return
     * @author DH-Xxj
     */
    @RequiresPermissions("hr:operatecompanyapply:flow")
    @Log(title = "运营公司备案", businessType = BusinessType.FLOWGO)
    @PostMapping("/flowgopost")
    @ResponseBody
    @RepeatSubmit
    public AjaxResult flowGoSave(@RequestParam Map<String, Object> params){    	
		params.put("moduleTable", moduleTable);
    	AjaxResult ajaxResult = new AjaxResult();   
        try {
            ajaxResult= businessService.updateFlowGo(params);
        }catch (Exception e) {
            ajaxResult = AjaxResult.error(this.getExceptionMessage(e));
        }
        return ajaxResult;
    }

    /**
     * 批量流转通过
     */
    @GetMapping("/flowgopostLocal")
    @ResponseBody
    public AjaxResult flowgopostLocal(){    	
		
    	List<OperateCompanyApply> listOperateCompanyApply = businessService.queryListUnEnd();
    	
    	for(OperateCompanyApply entity : listOperateCompanyApply) {
    		String bid = entity.getBid();
    		businessService.updateFlowGoPass(bid);
    	}
    	
        return AjaxResult.success();
    }

    /**
     * 退回
	 * @param infoMap 必要参数：非网格字段（包括头部、底部所有显示和隐藏的字段）
	 * @param infoItems 必要参数：对应实体类的json格式字符串（仅需 guid）
     * @return
     * @author DH-Xxj
     */
    @RequiresPermissions("hr:operatecompanyapply:flow")
    @Log(title = "运营公司备案", businessType = BusinessType.FLOWBACK)
    @PostMapping("/flowbackpost")
    @ResponseBody
    @RepeatSubmit
    public AjaxResult flowBackSave(@RequestParam Map<String, Object> params){		
		params.put("moduleTable", moduleTable);
    	AjaxResult ajaxResult = new AjaxResult();    	
        try {
            ajaxResult= businessService.updateFlowBack(params);
        }catch (Exception e) {
            ajaxResult = AjaxResult.error(this.getExceptionMessage(e));
        }
        return ajaxResult;
    }

    /**
	 * 运营公司信息查询
	 * @param otherWhere 可选参数：查询附加条件[1：普通员工只查自己绑定的，管理员查全部]
     * @return
     * @author DH-Xxj
     */
	@GetMapping("/operatecompanyinfo/list")
    @ResponseBody
    public TableDataInfo queryOperateCompanyInfoList(@RequestParam Map<String, Object> params){
		params.put("moduleTable", moduleTableInfo);	//运营公司信息
        List<OperateCompanyApply> list = new ArrayList<OperateCompanyApply>();
        try {
        	list = businessService.queryOperateCompanyInfoList(params);
        } catch (Exception e) {
            e.printStackTrace();
            return getDataTable(this.getExceptionMessage(e).toString());            
        }
        return getDataTable(list);
    }

    /**
     *
     * @param params
     * @return
     * @author DH-Xxj
     */
    @GetMapping("/operatecompanyinfo/list2")
    @ResponseBody
    public TableDataInfo queryBoundCompanyList(@RequestParam Map<String, Object> params){
        params.put("moduleTable", moduleTableTC);
        List<OperateCompanyApply> list = new ArrayList<OperateCompanyApply>();
        try {
            list = businessService.queryList2(params);
        } catch (Exception e) {
            e.printStackTrace();
            return getDataTable(this.getExceptionMessage(e).toString());
        }
        return getDataTable(list);
    }

	/**
	 * 从运营公司信息调入运营公司退出
	 * @param params
	 * @return
	 * @author DH-Xxj
	 */
    @RequiresPermissions("hr:operatecompanyapply:list")
	@GetMapping("/calloperatecompanyexitlist")
    @ResponseBody
    public TableDataInfo callOperateCompanyExitList(@RequestParam Map<String, Object> params){
		params.put("jurisdictionModuleTable", moduleTable);		//使用单据moduleTable分配的数据权限
        List<OperateCompanyExit> list = new ArrayList<OperateCompanyExit>();
        try {
        	list = businessService.callOperateCompanyExitList(params);
        } catch (Exception e) {
            e.printStackTrace();
            return getDataTable(this.getExceptionMessage(e).toString());            
        }
        return getDataTable(list);
    }

    /**
     *@Description: 查询已选择的员工
     *@Param: selectedUser ：已选中的商品编号字符串，示例：0000,1001,1002
     *@return: com.dhecp.common.core.page.TableDataInfo
     *@Author: fxz
     *@date: 2024-03-04
     */
    @GetMapping("/listselect")
    @ResponseBody
    public TableDataInfo userInfoSelectListJson(@RequestParam Map<String, Object> params){
        params.put("moduleTable", moduleTable);
        List<OperateCompanyApply> list = new ArrayList<OperateCompanyApply>();
        if (params.get("selectedUser") != null && params.get("selectedUser") != ""){
            String wherestrhand = "t1.vGsBm in ('" + params.get("selectedUser").toString().replace(",", "','") + "')";
            params.put("wherestrhand", wherestrhand);
            try{
                list = businessService.queryList2(params);
            }catch(Exception e){
                return getDataTable(this.getExceptionMessage(e).toString());
            }
        }else{
            return getDataTable("请传入已选中的商品编码字符串（selectedUser），取值示例：0000,1001,1002");
        }
        return getDataTable(list);
    }
    
}
